package com.dianping.cat.consumer.all.config.transform;

import com.dianping.cat.consumer.all.config.entity.AllConfig;
import com.dianping.cat.consumer.all.config.entity.Name;
import com.dianping.cat.consumer.all.config.entity.Report;
import com.dianping.cat.consumer.all.config.entity.Type;
import org.xml.sax.Attributes;




public class DefaultSaxMaker
  extends Object
  implements IMaker<Attributes>
{
/* 16 */   public AllConfig buildAllConfig(Attributes attributes) { return new AllConfig(); }





  public Name buildName(Attributes attributes) {
/* 23 */     String id = attributes.getValue("id");
/* 24 */     Name name = new Name();

/* 26 */     if (id != null) {
/* 27 */       name.setId(id);
    }

/* 30 */     return name;
  }


  public Report buildReport(Attributes attributes) {
/* 35 */     String id = attributes.getValue("id");
/* 36 */     return new Report(id);
  }




  public Type buildType(Attributes attributes) {
/* 43 */     String id = attributes.getValue("id");
/* 44 */     return new Type(id);
  }




  protected <T> T convert(Class<T> type, String value, T defaultValue) {
/* 51 */     if (value == null || value.length() == 0) {
/* 52 */       return defaultValue;
    }

/* 55 */     if (type == Boolean.class || type == boolean.class)
/* 56 */       return (T)Boolean.valueOf(value); 
/* 57 */     if (type == Integer.class || type == int.class)
/* 58 */       return (T)Integer.valueOf(value); 
/* 59 */     if (type == Long.class || type == long.class)
/* 60 */       return (T)Long.valueOf(value); 
/* 61 */     if (type == Short.class || type == short.class)
/* 62 */       return (T)Short.valueOf(value); 
/* 63 */     if (type == Float.class || type == float.class)
/* 64 */       return (T)Float.valueOf(value); 
/* 65 */     if (type == Double.class || type == double.class)
/* 66 */       return (T)Double.valueOf(value); 
/* 67 */     if (type == Byte.class || type == byte.class)
/* 68 */       return (T)Byte.valueOf(value); 
/* 69 */     if (type == Character.class || type == char.class) {
/* 70 */       return (T)Character.valueOf(value.charAt(0));
    }
/* 72 */     return (T)value;
  }
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/lib/cat-consumer-3.0.0.jar!/com/dianping/cat/consumer/all/config/transform/DefaultSaxMaker.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */